module type TCarte =
  sig
    type carte
    val appeler_en_priorite: carte list list
  end


module Make (Carte: TCarte) =
    struct
      let cartes_appelables main =
	let inclus x y =
	  let rec examiner = function
	    | [] -> true
	    | hd :: tl -> 
	       List.exists (fun x -> x = hd) y
	       && examiner tl
	  in
	  examiner x
	in
	let (<|) = inclus in
	let rec examiner_pallier = function
	  | [] -> []
	  | pallier :: tl when pallier <| main ->
	     pallier @ (examiner_pallier tl)
	  | pallier :: _ -> pallier
	in
	examiner_pallier Carte.appeler_en_priorite
    end
